# 同步代码：
# import time
#
#
# def hello():
#     time.sleep(1)
#
#
# def run():
#     for i in range(5):
#         hello()
#         print('Hello World:%s' % time.time())  # 任何伟大的代码都是从Hello World 开始的！
#
#
# if __name__ == '__main__':
#     run()
#
# 异步代码：
import time
import asyncio


# 定义异步函数
async def hello():
    await asyncio.sleep(1)
    print('Hello World:%s' % time.time())


async def run():
    tasks = list()
    for i in range(50):
        tasks.append(hello())

    await asyncio.wait(tasks)


if __name__ == '__main__':
    asyncio.run(run())
